import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

import Layout from '@/layout/Layout.vue'

const routes: RouteRecordRaw[] = [
    //登录页面
    {
        path: '/login',
        component: () => import('@/views/Login/Login.vue')
    },
    {
        path: '/',
        //重定向
        redirect: '/Index/index'
    },
    // 首页
    {
         path:'/Index',
         component: Layout,
         redirect: '/Index/index',
         children: [
            {
                path:'index',
                component: () => import('@/views/Index/index.vue')
            }
         ]
    },
    //医院综合
    {
        path: '/Synthesis',
        component: Layout,
        redirect: '/Synthesis/Manage',
        meta: { title: '医院综合', path: '/Synthesis' },
        children: [
            {
                path: 'Manage',
                meta: { title: '科室管理', path: '/Synthesis/Manage' },
                component: () => import('@/views/Synthesis/Manage.vue')
            },
            {
                path: 'Add',
                meta: { title: '添加科室', path: '/Synthesis/Add' },
                component: () => import('@/views/Synthesis/Add.vue')
            }
        ]
    },
    //患者大数据
    {
        path: '/PatientData',
        component: Layout,
        redirect: '/PatientData/Data',
        meta: { title: '患者大数据', path: '/PatientData' },
        children: [
            {
                path: 'Data',
                meta: { title: '疾病大数据', path: '/PatientData/Data' },
                component: () => import('@/views/PatientData/Data.vue')
            },
            {
                path: 'Census',
                meta: { title: '药品耗材统计', path: '/PatientData/Census' },
                component: () => import('@/views/PatientData/Census.vue')
            }
        ]
    },
    //动态个人
    {
        path: '/Personal',
        component: Layout,
        redirect: '/Personal/Manage',
        meta: { title: '动态个人', path: '/Personal' },
        children: [
            {
                path: 'Manage',
                meta: { title: '挂号管理', path: '/Personal/Manage' },
                component: () => import('@/views/Personal/Manage.vue')
            },
        ]
    },
    //中西医药房
    {
        path: '/Pharmacy',
        component: Layout,
        redirect: '/Pharmacy/Sheet',
        meta: { title: '中西医药房', path: '/FulfillmentCenter' },
        children: [
            {
                path: 'Sheet',
                meta: { title: '营收数据表', path: '/Pharmacy/Sheet' },
                component: () => import('@/views/Pharmacy/Sheet.vue')
            },
            {
                path: 'Manage',
                meta: { title: '处方综合管理', path: '/Pharmacy/Manage' },
                component: () => import('@/views/Pharmacy/Manage.vue')
            },
        ]
    },
    // 医疗前线
    {
        path: '/Front',
        component: Layout,
        redirect: '/Front/Lssued',
        meta: { title: '医疗前线', path: '/Front' },
        children: [
            {
                path: 'Lssued',
                meta: { title: '处方开具', path: '/Front/Lssued' },
                component: () => import('@/views/Front/Lssued.vue')
            },
            {
                path: 'Manage',
                meta: { title: '处方综合管理', path: '/Front/Manage' },
                component: () => import('@/views/Front/Manage.vue')
            },
        ]
    },
    //  医疗药品出入库
    {
        path: '/OutEnter',
        component: Layout,
        redirect: '/OutEnter/Manage',
        meta: { title: '医疗药品出入库', path: '/OutEnter' },
        children: [
            {
                path: 'Manage',
                meta: { title: '医疗用品综合管理', path: '/OutEnter/Manage' },
                component: () => import('@/views/OutEnter/Manage.vue')
            },
            {
                path: 'Add',
                meta: { title: '添加药品耗材', path: '/OutEnter/Add' },
                component: () => import('@/views/OutEnter/Add.vue')
            }
        ]
    },
    //  分级医生
    {
        path: '/DoctorGrade',
        component: Layout,
        redirect: '/DoctorGrade/List',
        meta: { title: '分级医生', path: '/DoctorGrade' },
        children: [
            {
                path: 'List',
                meta: { title: '综合列表', path: '/DoctorGrade/List' },
                component: () => import('@/views/DoctorGrade/List.vue')
            },
            {
                path: 'Rostering',
                meta: { title: '排班管理', path: '/DoctorGrade/Rostering' },
                component: () => import('@/views/DoctorGrade/Rostering.vue')
            },
            {
                path: 'Info',
                meta: { title: '修改个人信息', path: '/DoctorGrade/Info' },
                component: () => import('@/views/DoctorGrade/Info.vue')
            }
        ]
    },
    //  分级护士
    {
        path: '/NurseGrade',
        component: Layout,
        redirect: '/NurseGrade/List',
        meta: { title: '分级医生', path: '/NurseGrade' },
        children: [
            {
                path: 'List',
                meta: { title: '综合列表', path: '/NurseGrade/List' },
                component: () => import('@/views/NurseGrade/List.vue')
            },
            {
                path: 'Rostering',
                meta: { title: '排班管理', path: '/NurseGrade/Rostering' },
                component: () => import('@/views/NurseGrade/Rostering.vue')
            },
            {
                path: 'Info',
                meta: { title: '修改个人信息', path: '/NurseGrade/Info' },
                component: () => import('@/views/NurseGrade/Info.vue')
            }
        ]
    },
    //  病床管理
    {
        path: '/HospitalBed',
        component: Layout,
        redirect: '/HospitalBed/Add',
        meta: { title: '病床管理', path: '/HospitalBed' },
        children: [
            {
                path: 'Add',
                meta: { title: '添加床位', path: '/HospitalBed/Add' },
                component: () => import('@/views/HospitalBed/Add.vue')
            },
            {
                path: 'Manage',
                meta: { title: '综合管理', path: '/HospitalBed/Manage' },
                component: () => import('@/views/HospitalBed/Manage.vue')
            }
        ]
    },
    //  全账号管理
    {
        path: '/AccountAll',
        component: Layout,
        redirect: '/AccountAll/Add',
        meta: { title: '全账号管理', path: '/AccountAll' },
        children: [
            {
                path: 'Account',
                meta: { title: '账号管理', path: '/AccountAll/Account' },
                component: () => import('@/views/AccountAll/Account.vue')
            },
            {
                path: 'Add',
                meta: { title: '添加科室', path: '/AccountAll/Add' },
                component: () => import('@/views/AccountAll/Add.vue')
            }
        ]
    },
    //404页面
    {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: () => import('@/views/error/index.vue')
    }
]

const router = createRouter({
    //创建路由模式  hash和history
    //现在用的是hash模式  地址带有/#
    history: createWebHashHistory(),
    routes,
})

export default router